package com.eco.utils;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/* loaded from: newfishway-1.0.0-SNAPSHOT.jar:BOOT-INF/classes/com/eco/utils/DateAndStringUtils.class */
public class DateAndStringUtils {
    private static final Logger log = LoggerFactory.getLogger((Class<?>) DateAndStringUtils.class);

    public static String getSuffixUrl(Integer id, String createdAt, String times, Integer timestamp) {
        String[] split = StringUtils.split(createdAt, StringUtils.SPACE);
        String dateStr = split[0].replaceAll("-", "");
        String suffixUrl = dateStr + "/" + times + "/fs_" + id + "_" + timestamp2Time(timestamp);
        return suffixUrl;
    }

    public static String getSonarSuffixUrl(String createdAt, String times, String fileName) {
        String[] split = StringUtils.split(createdAt, StringUtils.SPACE);
        String dateStr = split[0].replaceAll("-", "");
        String suffixUrl = dateStr + "/" + times + "/fs_" + fileName;
        return suffixUrl;
    }

    public static String dateTimeNow2() {
        LocalDateTime dateTime = LocalDateTime.now();
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        return dateTime.format(fmt);
    }

    public static String dateTimeNow() {
        LocalDateTime dateTime = LocalDateTime.now();
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return dateTime.format(fmt);
    }

    public static String dateNow() {
        LocalDateTime dateTime = LocalDateTime.now();
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return dateTime.format(fmt);
    }

    public static String timestamp2Time(Integer timestampStr) {
        Long timestamp = Long.valueOf(Long.parseLong(timestampStr.toString()) * 1000);
        String date = new SimpleDateFormat("HHmmss", Locale.CHINA).format(new Date(timestamp.longValue()));
        return date;
    }
}